package com.xinhua.controller.util;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//作为springmvc异常处理器
//@ControllerAdvice
@RestControllerAdvice
public class ProjectException {
    //拦截所有的异常信息
    @ExceptionHandler
    public R doException(Exception en) {
        //记录日志
        //通知运维
        //通知开发
        en.printStackTrace();
        return new R("服务器故障,请联系管理员");
    }
}
